<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\User;
use App\Online;
use App\Log_login;
class UsersController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }
    
    //根据token 获取id
    static public function getIdByToken($token){
    	$id = '';
    	$online = Online::where('token',$token)->first();
    	if ($online){
    		$id = $online->user_id;
    	}    	
    	return $id;
    }

	//根据web token 获取id
	static public function getIdByWebToken($token){
		$id = '';
		$log = Log_login::where('token',$token)->first();
		if ($log){
			$id = $log->user_id;
		}
		return $id;
	}


}
